package com.atguigu.day03;

import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class NotSafeDemo2 {
    public static void main(String[] args) {
//        ArrayList<String> list = new ArrayList<>();
//        List<String> list = new Vector<>();
        //HashMap使用的是ConcurrentHashMap
        Map<String,String> map = new ConcurrentHashMap<>();

        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
//                 list.add("a");
                map.put(Thread.currentThread().getName(), UUID.randomUUID().toString().substring(1, 7));
                System.out.println(map);

            }, String.valueOf(i)).start();
        }
    }
}
